class DataLoadService {
  static transactional = false

  def loadAll() {

    def c = new Volunteer(firstName: 'Bugs', lastName: 'Bunny', email: 'bugsbunny@warnerbros.com', password: 'bb')
    c.save()

    def e1 = new Event(name: "event1", description: "e1d1 -- the description of the event", location: "e1l1", startDate: new Date(), endDate: new Date() + 7, owner: c).save()
    def e1p1 = new EventPosition(name: "e1p1", description: "e1p1d1", location: "e1p1l1", numberOfVolunteers: 5, startDate: new Date() + 1, endDate: new Date() + 5)
    e1.addToPositions(e1p1).save()

    def e2 = new Event(name: "event2", description: "e2d1 -- the description of the event", location: "e2l1", startDate: new Date(), endDate: new Date() + 7, owner: c).save()
    def e2p1 = new EventPosition(name: "e2p1", description: "e2p1d1", location: "e2p1l1", numberOfVolunteers: 6, startDate: new Date() + 1, endDate: new Date() + 3)
    e2.addToPositions(e2p1).save()
    e2p1.addToVolunteers(c).save()
    def e3 = new Event(name: "event3", description: "e3d1 -- the description of the event", location: "e3l1", startDate: new Date(), endDate: new Date() + 30, owner: c).save()
    e3.addToPositions(new EventPosition(name: "e3p1", description: "e3p1d1", location: 'e3p1l1', numberOfVolunteers: 8, startDate: new Date() + 2, endDate: new Date() + 21)).save()
    e3.addToPositions(new EventPosition(name: "e3p2", description: "e3p2d1", location: 'e3p2l1', numberOfVolunteers: 9, startDate: new Date() + 5, endDate: new Date() + 15)).save()

    def c2 = new Volunteer(firstName: 'Elmer', lastName: 'Fudd', email: 'efudd@warnerbros.com', password: 'ef')
    c2.save()
    def ce1 = new Event(name: "cevent1", description: "ce1d1 -- cool event!", location: "ce1l1", startDate: new Date() + 4, endDate: new Date() + 18, owner: c2).save()
    ce1.addToPositions(new EventPosition(name: "ce1p1", description: "ce1p1d1", location: "ce1p1l1", numberOfVolunteers: 5, startDate: new Date(), endDate: new Date())).save()

    def ce2 = new Event(name: "cevent2", description: "ce2d1 -- it's a description", location: "ce2l1", startDate: new Date(), endDate: new Date() + 7, owner: c2).save()
    def c2ep1 = new EventPosition(name: "ce2p1", description: "ce2p1d1", location: "ce2p1l1", numberOfVolunteers: 5, startDate: new Date() + 1, endDate: new Date() + 5)
    ce2.addToPositions(c2ep1).save()
    c2ep1.addToVolunteers(c).save()

    def ce3 = new Event(name: "cevent3", description: "ce3d1-- tell it", location: "ce3l1", startDate: new Date(), endDate: new Date() + 45, owner: c2).save()
    def c2e3p1 = new EventPosition(name: "ce3p1", description: "ce3p1d1", location: 'ce3p1l1', numberOfVolunteers: 10, startDate: new Date() + 2, endDate: new Date() + 4)
    ce3.addToPositions(c2e3p1).save()
    c2e3p1.addToVolunteers(c).save()
    c2e3p1.addToVolunteers(c2).save()
    ce3.addToPositions(new EventPosition(name: "ce3p2", description: "ce3p2d1", location: 'ce3p2l1', numberOfVolunteers: 15, startDate: new Date() + 3, endDate: new Date() + 30)).save()
    ce3.addToPositions(new EventPosition(name: "ce3p3", description: "ce3p3d1", location: 'ce3p3l1', numberOfVolunteers: 5, startDate: new Date() + 10, endDate: new Date() + 45)).save()
  }
}